﻿using FreeSql.DataAnnotations;
using IMES.Common.Dtos;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IMES.Common.Domain.KeepModel
{
	/// <summary>
	/// 任务表
	/// </summary>
	public class TaskTable : Audit
	{
		/// <summary>
		/// 任务编号
		/// </summary>
		[Column(IsIdentity = true, IsPrimary = true)]
		public int TaskId { get; set; }
		/// <summary>
		/// 工序编号
		/// </summary>
		public int ProcessNumber { get; set; } 
		/// <summary>
		/// 工单编号
		/// </summary>
		[MaxLength(50)]
		public string WorkSheetNumber { get; set; }
		/// <summary>
		/// 工序名称
		/// </summary>
		public string? ProcessName { get; set; }
		/// <summary>
		/// 报工权限
		/// </summary>
		public int? ReportingAuthority { get; set; }
		//将工单下单的单位与实际生产单位进行匹配和转换的比例。例如，如果工单的单位是千克，而实际生产过程中的单位是件，那么就需要一个配比来表示1千克等于多少件
		/// <summary>
		/// 报工数配比
		/// </summary>
		public int Matching { get; set; }
		/// <summary>
		/// 不良品项列表
		/// </summary>
		public string? AdverseList { get; set; }

		/// <summary>
		/// 计划开始时间
		/// </summary> 
		public DateTime? ScheduledStartTime { get; set; }
		/// <summary>
		/// 计划结束时间
		/// </summary> 
		public DateTime? ScheduledEndTime { get; set; }
		/// <summary>
		/// 计划数
		/// </summary>
		[Range(0, int.MaxValue)]
		public int Numberofpackages { get; set; }
		/// <summary>
		/// 实际数量
		/// </summary>
		public int RealQuantity { get; set; }
		/// <summary>
		/// 计划良品数
		/// </summary>
		public int GoodScore { get; set; }
		/// <summary>
		/// 不良品数量
		/// </summary>
		public int DefectiveQuantity { get; set; }
		/// <summary>
		/// 报工时常
		/// </summary>
        public int ActualTime { get; set; }
        /// <summary>
        ///实际开始时间
        /// </summary> 
        public DateTime? ActualStartTime { get; set; }
		/// <summary>
		/// 实际结束时间
		/// </summary> 
		public DateTime? ActualEndTime { get; set; }
		/// <summary>
		/// 状态
		/// </summary>
		public TaskState State { get; set; }

	}

	/// <summary>
	/// 工单状态枚举
	/// </summary>
	public enum TaskState
	{
		未开始 = 1,
		进行中 = 2,
		已完成 = 3, 
	}
}
